package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the pays database table.
 * 
 */
@Entity
@Table(name="pays")
@NamedQuery(name="Pay.findAll", query="SELECT p FROM Pay p")
public class Pay implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idPays;

	private String nom;

	//bi-directional many-to-one association to Adresse
	@OneToMany(mappedBy="pay")
	private List<Adresse> adresses;

	//bi-directional many-to-one association to Cursus
	@OneToMany(mappedBy="pay")
	private List<Cursus> cursuses;

	public Pay() {
	}

	public int getIdPays() {
		return this.idPays;
	}

	public void setIdPays(int idPays) {
		this.idPays = idPays;
	}

	public String getNom() {
		return this.nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public List<Adresse> getAdresses() {
		return this.adresses;
	}

	public void setAdresses(List<Adresse> adresses) {
		this.adresses = adresses;
	}

	public Adresse addAdress(Adresse adress) {
		getAdresses().add(adress);
		adress.setPay(this);

		return adress;
	}

	public Adresse removeAdress(Adresse adress) {
		getAdresses().remove(adress);
		adress.setPay(null);

		return adress;
	}

	public List<Cursus> getCursuses() {
		return this.cursuses;
	}

	public void setCursuses(List<Cursus> cursuses) {
		this.cursuses = cursuses;
	}

	public Cursus addCursus(Cursus cursus) {
		getCursuses().add(cursus);
		cursus.setPay(this);

		return cursus;
	}

	public Cursus removeCursus(Cursus cursus) {
		getCursuses().remove(cursus);
		cursus.setPay(null);

		return cursus;
	}

}